<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <!-- <input type="text"> -->
    <div class="ipt_box">
        <input type="text" class="ipt">
        <div class="son">请输入正确的手机号码</div>
    </div>
    <script>
        // var ipt = document.querySelector('input');
        // ipt.addEventListener('change', function() {
        //     console.log(this.value);
        // })
        // ipt.addEventListener('focus', function() {
        //     console.log(1111);
        // })
        // ipt.addEventListener('blur', function() {
        //     console.log(2222);
        // })

        var ipt = document.querySelector('.ipt');
        var son = document.querySelector('.son');

        ipt.addEventListener('blur', function() {
            var val = this.value;
            if (val.length == 11 && isNaN(val) == false) {
                son.innerHTML = 'ok';
            } else {
                son.innerHTML = 'error';
            }
        })
    </script>
</body>

</html>